package tt.dz.order.pojo;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import tt.dz.order.dao.BaseDAOUtil;

/**
 * 订单项修改日志
 * 
 * @author NIBO
 *
 */
public class OrderItemChangeLogInfo extends OrderItem {

	private static final String SELECT_ALL_SQL = "select service.name as serviceName,item.startTime, item.endTime, item.createTime,changeId,orderNo, userId, item.serviceNo, serviceProvider, isCost, unitNo, unitPrice, realUnitPrice, buyNum, freeNum, totalPrice, realTotalPrice, activityRule, serviceStationNo, equipmentNo, auxEquipmentNo, startTime, endTime, item.createTime,message from order_item_change_log item INNER JOIN order_service_info service ON service.serviceno=item.serviceno ";
	private String changeId;

	private String serviceName;


	public String getChangeId() {
		return changeId;
	}


	public void setChangeId(String changeId) {
		this.changeId = changeId;
	}


	public String getServiceName() {
		return serviceName;
	}


	public void setServiceName(String serviceName) {
		this.serviceName = serviceName;
	}

	@Override
	public void save(){
		String sql = "insert into order_item_change_log(changeId,orderNo, userId, serviceNo, serviceProvider, isCost, unitNo, unitPrice, realUnitPrice, buyNum, freeNum, totalPrice, realTotalPrice, activityRule, serviceStationNo, equipmentNo, auxEquipmentNo, startTime, endTime, createTime,message) values(:changeId,:orderNo, :userId, :serviceNo, :serviceProvider, :isCost, :unitNo, :unitPrice, :realUnitPrice, :buyNum, :freeNum, :totalPrice, :realTotalPrice, :activityRule, :serviceStationNo, :equipmentNo, :auxEquipmentNo, :startTime, :endTime, :createTime,:message)";
		BaseDAOUtil.updateObject(sql, this);
	}
	public static List<OrderItemChangeLogInfo> queryByChangeId(String changeId) {
		String sql=SELECT_ALL_SQL+" where changeId = :changeId";
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("changeId", changeId);
		return BaseDAOUtil.queryForList(sql, paramMap, OrderItemChangeLogInfo.class);
	}
}
